Refactoring preparing test environment.

This commit is contained in:
Roman Telezhynskyi 2023-01-11 14:02:35 +02:00
parent 47db665c21
commit 19344de569
6 changed files with 111 additions and 358 deletions

View File

@ -1,5 +1,4 @@
import qbs.FileInfo
import qbs.File
CppApplication {
Depends { name: "buildconfig" }
@ -83,46 +82,4 @@ CppApplication {
qbs.install: true
qbs.installDir: buildconfig.installBinaryPath
}
Rule {
multiplex: true
alwaysRun: true
condition: qbs.targetOS.contains("windows") && (qbs.architecture.contains("x86_64") || qbs.architecture.contains("x86"))
inputs: ["openssl_dist"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["openssl_dist"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.highlight = "filegen";
cmd.description = "Preparing test suit";
var sources = inputs["openssl_dist"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
cmd.destination = outputs["testSuit"].map(function(artifact) {
return artifact.filePath;
});
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
}

View File

@ -2,13 +2,20 @@ import qbs.FileInfo
VApp {
Depends { name: "freedesktop2" }
Depends { name: "tenv" }
version: "0.7.52"
type: base.concat("testSuit")
install: true
installDir: buildconfig.installAppPath
installDebugInformation: true
Properties {
// Breakpoints do not work if debug the app inside of bundle. In debug mode we turn off creating a bundle.
// Probably it will breake some dependencies. Version for Mac designed to work inside an app bundle.
condition: qbs.targetOS.contains("macos") && qbs.buildVariant == "debug"
bundle.isBundle: false
}
Properties {
condition: buildconfig.enableAppImage && qbs.targetOS.contains("unix") && !qbs.targetOS.contains("macos")
cpp.dynamicLibraries: ["icudata", "icui18n", "icuuc"]

103
qbs/modules/tenv/tenv.qbs Normal file
View File

@ -0,0 +1,103 @@
import qbs.FileInfo
import qbs.File
Module {
additionalProductTypes: "tenv.deps"
// Use this property to preparing test environment. By default for debug purposes we copy some nessesary files and
// libraries into build directory.
property bool enableTestEnvironment: true
Rule {
multiplex: true
// alwaysRun: true
condition: enableTestEnvironment
inputs: ["pdftops_dist_macx", "pdftops_dist_win", "openssl_dist", "multisize_tables", "label_templates"]
outputFileTags: ["tenv.deps"]
outputArtifacts: {
var artifactNames = (inputs["pdftops_dist_macx"] || []).map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
artifactNames = artifactNames.concat((inputs["pdftops_dist_win"] || []).map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
}));
artifactNames = artifactNames.concat((inputs["openssl_dist"] || []).map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
}));
artifactNames = artifactNames.concat((inputs["multisize_tables"] || []).map(function(file){
return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize",file.fileName);
}));
artifactNames = artifactNames.concat((inputs["label_templates"] || []).map(function(file){
return FileInfo.joinPaths(product.buildDirectory, "labels",file.fileName);
}));
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["tenv.deps"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Preparing test environment";
cmd.highlight = "filegen";
var sources = (inputs["pdftops_dist_macx"] || []).map(function(artifact) {
return artifact.filePath;
});
sources = sources.concat((inputs["pdftops_dist_win"] || []).map(function(artifact) {
return artifact.filePath;
}));
sources = sources.concat((inputs["openssl_dist"] || []).map(function(artifact) {
return artifact.filePath;
}));
sources = sources.concat((inputs["multisize_tables"] || []).map(function(artifact) {
return artifact.filePath;
}));
sources = sources.concat((inputs["label_templates"] || []).map(function(artifact) {
return artifact.filePath;
}));
cmd.sources = sources;
var destination = (inputs["pdftops_dist_macx"] || []).map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, artifact.fileName);
});
destination = destination.concat((inputs["pdftops_dist_win"] || []).map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, artifact.fileName);
}));
destination = destination.concat((inputs["openssl_dist"] || []).map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, artifact.fileName);
}));
destination = destination.concat((inputs["multisize_tables"] || []).map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", artifact.fileName);
}));
destination = destination.concat((inputs["label_templates"] || []).map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, "labels", artifact.fileName);
}));
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
}

View File

@ -176,50 +176,6 @@ VToolApp {
qbs.installDir: buildconfig.installBinaryPath
}
Rule {
multiplex: true
alwaysRun: true
condition: qbs.targetOS.contains("windows") && (qbs.architecture.contains("x86_64") || qbs.architecture.contains("x86"))
inputs: ["pdftops_dist_win"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["pdftops_dist_win"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.highlight = "filegen";
cmd.description = "Preparing test suit";
var sources = inputs["pdftops_dist_win"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
var destination = inputs["pdftops_dist_win"].map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
Group {
condition: qbs.targetOS.contains("macos") && qbs.architecture.contains("x86_64")
name: "pdftops MacOS"
@ -230,50 +186,6 @@ VToolApp {
qbs.installDir: buildconfig.installBinaryPath
}
Rule {
multiplex: true
alwaysRun: true
condition: qbs.targetOS.contains("windows") && qbs.architecture.contains("x86_64") && qbs.buildVariant === "debug"
inputs: ["pdftops_dist_macx"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["pdftops_dist_macx"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Preparing test suit";
cmd.highlight = "filegen";
var sources = inputs["pdftops_dist_macx"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
var destination = inputs["pdftops_dist_macx"].map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
Group {
name: "48x48/apps"
prefix: FileInfo.joinPaths(project.sourceDirectory, "share", "icons", "48x48", "apps", FileInfo.pathSeparator())

View File

@ -1,5 +1,4 @@
import qbs.FileInfo
import qbs.File
VToolApp {
Depends { name: "buildconfig" }
@ -100,49 +99,6 @@ VToolApp {
qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "tables" + FileInfo.pathSeparator() + "multisize"
}
Rule {
multiplex: true
alwaysRun: true
inputs: ["multisize_tables"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["multisize_tables"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Preparing multisize tables";
cmd.highlight = "filegen";
var sources = inputs["multisize_tables"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
var destination = inputs["multisize_tables"].map(function(file) {
return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName);
});
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
Group {
name: "Measurements templates"
prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "tables", "templates", FileInfo.pathSeparator())

View File

@ -1,5 +1,4 @@
import qbs.FileInfo
import qbs.File
VToolApp {
Depends { name: "buildconfig" }
@ -143,13 +142,6 @@ VToolApp {
ib.appIconName: "Valentina"
}
Properties {
// Breakpoints do not work if debug the app inside of bundle. In debug mode we turn off creating a bundle.
// Probably it will breake some dependencies. Version for Mac designed to work inside an app bundle.
condition: qbs.targetOS.contains("macos") && qbs.buildVariant == "debug"
bundle.isBundle: false
}
Export {
Depends { name: "cpp" }
cpp.defines: {
@ -174,49 +166,6 @@ VToolApp {
qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "labels"
}
Rule {
multiplex: true
alwaysRun: true
inputs: ["label_templates"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["label_templates"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, "labels", file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Preparing default labels";
cmd.highlight = "filegen";
var sources = inputs["label_templates"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
var destination = inputs["label_templates"].map(function(file) {
return FileInfo.joinPaths(product.buildDirectory, "labels", file.fileName);
});
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
Group {
name: "Multisize tables"
prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "tables", "multisize", FileInfo.pathSeparator())
@ -228,49 +177,6 @@ VToolApp {
qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "tables" + FileInfo.pathSeparator() + "multisize"
}
Rule {
multiplex: true
alwaysRun: true
inputs: ["multisize_tables"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["multisize_tables"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Preparing multisize tables";
cmd.highlight = "filegen";
var sources = inputs["multisize_tables"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
var destination = inputs["multisize_tables"].map(function(file) {
return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName);
});
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
Group {
name: "Measurements templates"
prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "tables", "templates", FileInfo.pathSeparator())
@ -293,50 +199,6 @@ VToolApp {
qbs.installDir: buildconfig.installBinaryPath
}
Rule {
multiplex: true
alwaysRun: true
condition: qbs.targetOS.contains("windows") && (qbs.architecture.contains("x86_64") || qbs.architecture.contains("x86"))
inputs: ["pdftops_dist_win"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["pdftops_dist_win"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Preparing test suit";
cmd.highlight = "filegen";
var sources = inputs["pdftops_dist_win"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
var destination = inputs["pdftops_dist_win"].map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
Group {
condition: qbs.targetOS.contains("macos") && qbs.architecture.contains("x86_64")
name: "pdftops MacOS"
@ -347,50 +209,6 @@ VToolApp {
qbs.installDir: buildconfig.installBinaryPath
}
Rule {
multiplex: true
alwaysRun: true
condition: qbs.targetOS.contains("windows") && qbs.architecture.contains("x86_64") && qbs.buildVariant === "debug"
inputs: ["pdftops_dist_macx"]
outputFileTags: ["testSuit"]
outputArtifacts: {
var artifactNames = inputs["pdftops_dist_macx"].map(function(file){
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
var artifacts = artifactNames.map(function(art){
var a = {
filePath: art,
fileTags: ["testSuit"]
}
return a;
});
return artifacts;
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Preparing test suit";
cmd.highlight = "filegen";
var sources = inputs["pdftops_dist_macx"].map(function(artifact) {
return artifact.filePath;
});
cmd.sources = sources;
var destination = inputs["pdftops_dist_macx"].map(function(artifact) {
return FileInfo.joinPaths(product.buildDirectory, file.fileName);
});
cmd.destination = destination;
cmd.sourceCode = function() {
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
return [cmd];
}
}
Group {
name: "48x48/apps"
prefix: FileInfo.joinPaths(project.sourceDirectory, "share", "icons", "48x48", "apps", FileInfo.pathSeparator())